package com.pipi.biyesheji.dao.manager.impl;

import com.pipi.biyesheji.dao.support.PageResult;
import com.pipi.biyesheji.dao.model.OrderitemDO;
import com.pipi.biyesheji.dao.query.OrderitemQuery;
import com.pipi.biyesheji.dao.mapper.ext.OrderitemExtMapper;
import com.pipi.biyesheji.dao.manager.OrderitemManager;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * Manager for Orderitem.
 */

@Component
public class OrderitemManagerImpl implements OrderitemManager{

    
    @Autowired
    protected OrderitemExtMapper orderitemExtMapper;
    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(OrderitemQuery query){
        return orderitemExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(OrderitemQuery query){
        return orderitemExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(Long id){
        return orderitemExtMapper.deleteByPrimaryKey(id);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(OrderitemDO record){
        return orderitemExtMapper.insertSelective(record);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<OrderitemDO> selectByQuery(OrderitemQuery query){
        return orderitemExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
    */
    @Override
    public PageResult<OrderitemDO> selectByQueryWithPage(OrderitemQuery query) {
        PageResult<OrderitemDO> result = new PageResult<OrderitemDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public OrderitemDO selectByPrimaryKey(Long id){
        return orderitemExtMapper.selectByPrimaryKey(id);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective( OrderitemDO record,  OrderitemQuery query){
        return orderitemExtMapper.updateByQuerySelective(record,  query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery( OrderitemDO record,  OrderitemQuery query){

        return orderitemExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(OrderitemDO record){
        return orderitemExtMapper.updateByPrimaryKeySelective(record);
    }
}